﻿@model LoginViewModel

<div class="row">

    @if (Model.EnableLocalLogin)
    {
        <div class="col-md-4">

            <h1 class="mt-5 mb-3">登录</h1>

            <form asp-route="Login">
                <input type="hidden" asp-for="ReturnUrl" />
                <div class="form-group">
                    <label asp-for="Username"></label>
                    <input class="form-control" placeholder="Username" asp-for="Username" autofocus>
                </div>

                <div class="form-group">
                    <label asp-for="Password"></label>
                    <input type="password" class="form-control" placeholder="Password" asp-for="Password" autocomplete="off">
                </div>

                @if (Model.AllowRememberLogin)
                {
                    <div class="form-check">
                        <input type="checkbox" asp-for="RememberLogin" class="form-check-input">
                        <label asp-for="RememberLogin" class="form-check-label">记住我</label>
                    </div>
                }

                <div class="mt-4 mb-4">
                    <button class="btn btn-primary" name="button" value="login">登录</button>
                    <button class="btn btn-light" name="button" value="cancel">取消</button>
                </div>

                <partial name="_ValidationSummary" />
            </form>
        </div>
    }

    @if (Model.VisibleExternalProviders.Any())
    {
        <div class="col-md-4 ml-5">

            <h1 class="mt-5 mb-3">External Login</h1>

            <div class="list-group">
                @foreach (var provider in Model.VisibleExternalProviders)
                {
                    <a class="list-group-item list-group-item-action"
                       asp-controller="External"
                       asp-action="Challenge"
                       asp-route-provider="@provider.AuthenticationScheme"
                       asp-route-returnUrl="@Model.ReturnUrl">
                        @provider.DisplayName
                    </a>
                }
            </div>
        </div>
    }

    @if (!Model.EnableLocalLogin && !Model.VisibleExternalProviders.Any())
    {
        <div class="alert alert-warning">
            <strong>Invalid login request</strong>
            There are no login schemes configured for this client.
        </div>
    }


</div>
<div class="row">
    
    <a class="nav-link text-dark" href="/account/register">如果没有注册过，请点这里注册</a>
</div>
